package com.home.Entity;


import javax.persistence.Column;
import com.home.Common.Common;
import com.home.Common.Resources_Duy;
import com.home.Common.Resources_Truc;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.swing.ImageIcon;

import org.hibernate.annotations.Proxy;

@Entity
@Proxy(lazy=false)
@Table(name="KHUVUCBAN")
public class KhuVucBan {
	@Id
	@Column(name="KVB_MASO")
	private long maSo;
	@Column(name="KVB_TEN")
	private String ten;
	@Column(name="KVB_HINHANH")
	private String hinhAnh;
	@Column(name="KVB_TINHTRANG")
	private boolean tinhTrang;
	@Column(name="KVB_MOTA")
	private String moTa;
	
	
	
	public long getMaSo() {
		return maSo;
	}
	public void setMaSo(long maSo) {
		this.maSo = maSo;
	}
	public String getTen() {
		return ten;
	}
	public void setTen(String ten) {
		this.ten = ten;
	}
	public String getHinhAnh() {
		return hinhAnh;
	}
	public void setHinhAnh(String hinhAnh) {
		this.hinhAnh = hinhAnh;
	}
	public boolean isTinhTrang() {
		return tinhTrang;
	}
	public void setTinhTrang(boolean tinhTrang) {
		this.tinhTrang = tinhTrang;
	}
	public String getMoTa() {
		return moTa;
	}
	public void setMoTa(String moTa) {
		this.moTa = moTa;
	}
	
	public ImageIcon getImageIcon()
	{		
		try{
			if(this.hinhAnh != null){
				ImageIcon img = new  ImageIcon(this.hinhAnh);
				return img;
			}else
				return Common.getImageIcon(Resources_Truc.KHUVUC_IMAGE);
		}catch(Exception e){
			return Common.getImageIcon(Resources_Truc.KHUVUC_IMAGE);
		}
	}
	
	@Override
	public String toString() {
		return getTen();
	}
	
}
